const request = (functionName, data) => {
    
    /*<remove trigger="prod">*/
    return new Promise((resolve, reject) => {
        wx.request(
            {
                url: `http://localhost:8080/api/${functionName}`,
                data,
                success(res){
                    resolve(res.data);
                },
                error(err){
                    reject(err);
                }
            }
        )
    })
    /*</remove>*/
    /*<jdists trigger="prod">
    return wx.cloud.callFunction({
        name: functionName,
        data
    })
    </jdists>*/
}
module.exports = {
    request: request
}